package com.conop.gradient;

public class SingletonSet implements ConvexSet
{
	
	private NDPoint _pnt;
	
	public SingletonSet(NDPoint pnt)
	{
		_pnt = new NDPoint(pnt);
	}
	
	public SingletonSet(int dim)
	{
		_pnt = new NDPoint(0.0, dim);
	}
	
	public SingletonSet(double[] arr)
	{
		_pnt = new NDPoint(arr);
	}
	
	@Override
	public boolean isFeasible(NDPoint pnt) 
	{
		return pnt.equals(_pnt);
	}

	@Override
	public NDPoint Projection(NDPoint pnt) 
	{
		return new NDPoint(_pnt);
	}

	@Override
	public String toString()
	{
		return new StringBuilder("Singleton set: ").append(_pnt.toString()).toString();
	}
}
